<template>
  <div class="container-wrap">
    <div class="top-bg">
      <div>中国工商银行</div>
    </div>
    <div class="card-wrap">
      <div class="card-title">
        <span>礼品目录</span>
      </div>
      <div class="card-list">
        <van-checkbox v-model="checked" @change="change">全选</van-checkbox>
        <van-checkbox-group v-model="result">
          <van-checkbox v-for="(item, index) in list" :key="item" :name="item">{{ item }} </van-checkbox>
        </van-checkbox-group>
      </div>
    </div>
    <div class="tip">注：多选一</div>
    <button class="queryButton" type="info" @click="next">下一步</button>

    <div class="footer">
      <div class="footer-content">本服务由甘肃省中国工商银行提供</div>
    </div>
  </div>
</template>

<script>
import { Toast } from 'vant'
export default {
  data() {
    return {
      list: ['水杯', '洗衣液', 'U盘', '香皂', '茶壶', '显示器'],
      result: [],
      lists: [], //在信息页面所携带的值
      checked: false, //全选
      relMark: null, //是否本人办理
      certType: '' //携带用户类型，以及
    }
  },
  created() {},

  methods: {
    // 下一步
    next() {
      console.log(this.lists.length)
      if (this.result.length === 0) {
        Toast('请选择礼品')
        return
      }
      if (this.result.length > 1) {
        Toast('只能选择一种')
        return
      }

      this.$router.push({
        path: '/download'
      })
    },
    // 全选
    change(val) {
      console.log(val, '123')
      if (val) {
        this.result = this.list
        console.log(this.result, 'this.result')
      } else {
        this.result = []
      }
    }
  }
}
</script>
<style lang="less" scoped>
.container-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: white;
  padding: 0 16px;
  overflow: auto;
  .card-list {
    padding-top: 12px;
    border-bottom: 1px solid #e8e8e8;
  }

  .top-bg {
    height: 140px;
    background: url('~@/assets/images/detailbg.png');
    background-size: 100% 100%;
    overflow: hidden;
    position: absolute;
    left: 0;
    right: 0;
    div {
      margin: 46.5px 12px 0;
      font-size: 18px;
      color: #fff;
    }
  }
  .card-wrap {
    margin-top: 120px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
    padding: 0 12px;
    position: relative;
    z-index: 3;
    .card-title {
      height: 37.5px;
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 18px;
      text-align: left;
      color: #333;
      border-bottom: 1px solid #e8e8e8;
      span {
        color: #999;
        font-weight: 400;
        font-size: 12px;
      }
    }
    .card-list {
      padding: 16px 0;
      border-bottom: 1px solid #e8e8e8;
    }
  }
  //  按钮
  .queryButton {
    height: 45px;
    border-radius: 4px;
    background: #3f87f3;
    color: #fff;
    font-size: 18px;
    margin: 30px 0 74px;
    width: 100%;
  }
  .footer {
    width: 100%;
    height: 127.5px;
    background-image: url(../assets/images/bgc.png);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: bottom;
    position: relative;
    bottom: 0 !important;
    left: 0;

    .footer-content {
      width: 100%;
      text-align: center;
      font-size: 14px;
      color: #999;
      position: absolute;
      bottom: 10px;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }
}
/deep/ .van-icon {
  width: 16px;
  height: 16px;
  line-height: 16px;
}

/deep/ .van-icon-success:before {
  content: '\E728';
  font-size: 16px;
}
/deep/ .van-checkbox__label {
  font-size: 15px;
  color: #333;
}
/deep/ .van-checkbox {
  margin-bottom: 11px;
  line-height: 20px;
}
.tip {
  margin-top: 10px;
  color: red;
}
</style>
